package com.zhu.char06

/**
 *
 * @version 1.0
 * @author study
 * @date 2020/9/5 12:10
 *
 */
object Scala_Trait18 {
  def main(args: Array[String]): Unit = {
    //动态混入特质
    val sut = new Student19 with TraitC {
      override def buy(): Unit =
        println("购物")

    }
  }
}

trait TratiA {
  def run(): Unit
}

trait TratiB {
  def speak(): Unit
}

trait TraitC {
  def buy(): Unit
}

//如果不存在继承关系，混入多个特质
//class MyClass18 extends TratiA with TratiB{}
class Student19 extends TratiA with TratiB {
  override def run(): Unit = ???

  override def speak(): Unit = ???
}
